<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <!--360浏览器优先以webkit内核解析-->


    <title> - 主页示例</title>

    <link rel="shortcut icon" href="favicon.ico">
    <link href="css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="css/font-awesome.css?v=4.4.0" rel="stylesheet">

    <link href="css/animate.css" rel="stylesheet">
    <link href="css/style.css?v=4.1.0" rel="stylesheet">

</head>
<style>
    .col-xs-6 {
        width: 31%;
    }
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="row">
        <div>
            <div class="row">
                <div class="row row-sm text-center">
                    <div class="col-xs-6">
                        <div class="panel padder-v item">
                            <div id="projectNum" class="h1 text-info font-thin h1">0</div>
                            <span class="text-muted text-xs">接入项目量</span>
                            <div class="top text-right w-full">
                                <i class="fa fa-caret-down text-warning m-r-sm"></i>
                            </div>
                        </div>
                    </div>
                    <div class="col-xs-6">
                        <div class="panel padder-v item bg-info">
                            <div id="retryTaskNum" class="h1 text-fff font-thin h1">0</div>
                            <span class="text-muted text-xs">任务量</span>
                            <div class="top text-right w-full">
                                <i class="fa fa-caret-down text-warning m-r-sm"></i>
                            </div>
                        </div>
                    </div>
                    <div class="col-xs-6">
                        <div class="panel padder-v item bg-primary">
                            <div id="sucessNum" class="h1 text-fff font-thin h1">0</div>
                            <span class="text-muted text-xs">成功任务</span>
                            <div class="top text-right w-full">
                                <i class="fa fa-caret-down text-warning m-r-sm"></i>
                            </div>
                        </div>
                    </div>
                    <div class="col-xs-6">
                        <div class="panel padder-v item" style="color: red;">
                            <div id="failNum" class="font-thin h1" style="color: red;">0</div>
                            <span class="text-muted text-xs" style="color: red;">失败任务</span>
                            <div class="bottom text-left">
                                <i class="fa fa-caret-up text-warning m-l-sm"></i>
                            </div>
                        </div>
                    </div>
                    <div class="col-xs-6">
                        <div class="panel padder-v item">
                            <div id="toStart" class="font-thin h1">0</div>
                            <span class="text-muted text-xs">待执行</span>
                            <div class="bottom text-left">
                                <i class="fa fa-caret-up text-warning m-l-sm"></i>
                            </div>
                        </div>
                    </div>
                    <div class="col-xs-6">
                        <div class="panel padder-v item">
                            <div id="process" class="font-thin h1">0</div>
                            <span class="text-muted text-xs">执行中</span>
                            <div class="bottom text-left">
                                <i class="fa fa-caret-up text-warning m-l-sm"></i>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-9" style="padding-right:0;">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title" style="border-bottom:none;background:#fff;">
                            <h5>活跃机器</h5>
                        </div>
                        <div class="ibox-content" style="border-top:none;">
                            <div id="yesterday" style="height:217px;">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-sm-3" style="padding-left:0;">
                    <div class="ibox float-e-margins">
                        <div class="ibox-content" style="border-top:none;background-color:#e4eaec;">
                            <h5>新增机器</h5>
                            <div class="progress progress-striped active">
                                <div style="width: 75%" aria-valuemax="100" aria-valuemin="0" aria-valuenow="75"
                                     role="progressbar" class="progress-bar">
                                    <span class="sr-only"></span>
                                </div>
                            </div>
                            <h5>历史机器</h5>
                            <div class="progress progress-striped active">
                                <div style="width: 75%" aria-valuemax="100" aria-valuemin="0" aria-valuenow="75"
                                     role="progressbar" class="progress-bar progress-bar-warning">
                                    <span class="sr-only"></span>
                                </div>
                            </div>
                            <h5>无心跳机器</h5>
                            <div class="progress progress-striped active">
                                <div style="width: 75%" aria-valuemax="100" aria-valuemin="0" aria-valuenow="75"
                                     role="progressbar" class="progress-bar .progress-bar-danger">
                                    <span class="sr-only"></span>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- 全局js -->
<script src="js/jquery.min.js?v=2.1.4"></script>
<script src="js/bootstrap.min.js?v=3.3.6"></script>
<script src="js/plugins/layer/layer.min.js"></script>
<!-- Flot -->
<script src="js/plugins/flot/jquery.flot.js"></script>
<script src="js/plugins/flot/jquery.flot.tooltip.min.js"></script>
<script src="js/plugins/flot/jquery.flot.resize.js"></script>
<script src="js/plugins/flot/jquery.flot.pie.js"></script>
<!-- 自定义js -->
<script src="js/content.js"></script>
<!--flotdemo-->
<script type="text/javascript">
    $(function () {
        loadRetryTaskSucess();
        loadProject();
        loadRetryTaskFail();
        loadRetryTask();
        loadRetryTaskProcess();
        loadRetryTaskToStart();

        function loadProject() {
            var url = "/retrytask/project/queryRetryTaskProject?pageNum=1&pageSize=1";
            $.ajax({
                url: url,
                type: "GET",
                data: {},
                dataType: "json",
                success: function (result) {
                    if (result.code == '-999') {
                        return;
                    }
                    var totalCount = result.totalCount;
                    $("#projectNum").text(totalCount);
                },
                error: function (err) {
                    console.log(err.statusText);
                    console.log('异常');
                },
                complete: function (XMLHttpRequest, textStatus) {
                    var redirect = XMLHttpRequest.getResponseHeader("Redirect");
                    if (redirect == "true") {
                        window.parent.location.href = XMLHttpRequest.getResponseHeader("RedirectUrl");
                    }
                }
            })
        }

        function loadRetryTask() {
            var url = "/retrytask/task/queryRetryTask?pageNum=1&pageSize=1";
            $.ajax({
                url: url,
                type: "GET",
                data: {},
                dataType: "json",
                success: function (result) {
                    if (result.code == '-999') {
                        return;
                    }
                    var totalCount = result.totalCount;
                    $("#retryTaskNum").text(totalCount);
                },
                error: function (err) {
                    console.log(err.statusText);
                    console.log('异常');
                },
                complete: function (XMLHttpRequest, textStatus) {
                    var redirect = XMLHttpRequest.getResponseHeader("Redirect");
                    if (redirect == "true") {
                        window.parent.location.href = XMLHttpRequest.getResponseHeader("RedirectUrl");
                    }
                }
            })
        }

        function loadRetryTaskSucess() {
            var url = "/retrytask/task/queryRetryTask?pageNum=1&pageSize=1&status=2";
            $.ajax({
                url: url,
                type: "GET",
                data: {},
                dataType: "json",
                success: function (result) {
                    if (result.code == '-999') {
                        return;
                    }
                    var totalCount = result.totalCount;
                    $("#sucessNum").text(totalCount);
                },
                error: function (err) {
                    console.log(err.statusText);
                    console.log('异常');
                },
                complete: function (XMLHttpRequest, textStatus) {
                    var redirect = XMLHttpRequest.getResponseHeader("Redirect");
                    if (redirect == "true") {
                        window.parent.location.href = XMLHttpRequest.getResponseHeader("RedirectUrl");
                    }
                }
            })
        }

        function loadRetryTaskFail() {
            var url = "/retrytask/task/queryRetryTask?pageNum=1&pageSize=1&status=-1";
            $.ajax({
                url: url,
                type: "GET",
                data: {},
                dataType: "json",
                success: function (result) {
                    if (result.code == '-999') {
                        return;
                    }
                    var totalCount = result.totalCount;
                    $("#failNum").text(totalCount);
                },
                error: function (err) {
                    console.log(err.statusText);
                    console.log('异常');
                },
                complete: function (XMLHttpRequest, textStatus) {
                    var redirect = XMLHttpRequest.getResponseHeader("Redirect");
                    if (redirect == "true") {
                        window.parent.location.href = XMLHttpRequest.getResponseHeader("RedirectUrl");
                    }
                }
            })
        }

        function loadRetryTaskProcess() {
            var url = "/retrytask/task/queryRetryTask?pageNum=1&pageSize=1&status=1";
            $.ajax({
                url: url,
                type: "GET",
                data: {},
                dataType: "json",
                success: function (result) {
                    if (result.code == '-999') {
                        return;
                    }
                    var totalCount = result.totalCount;
                    $("#process").text(totalCount);
                },
                error: function (err) {
                    console.log(err.statusText);
                    console.log('异常');
                },
                complete: function (XMLHttpRequest, textStatus) {
                    var redirect = XMLHttpRequest.getResponseHeader("Redirect");
                    if (redirect == "true") {
                        window.parent.location.href = XMLHttpRequest.getResponseHeader("RedirectUrl");
                    }
                }
            })
        }

        function loadRetryTaskToStart() {
            var url = "/retrytask/task/queryRetryTask?pageNum=1&pageSize=1&status=0";
            $.ajax({
                url: url,
                type: "GET",
                data: {},
                dataType: "json",
                success: function (result) {
                    if (result.code == '-999') {
                        return;
                    }
                    var totalCount = result.totalCount;
                    $("#toStart").text(totalCount);
                },
                error: function (err) {
                    console.log(err.statusText);
                    console.log('异常');
                },
                complete: function (XMLHttpRequest, textStatus) {
                    var redirect = XMLHttpRequest.getResponseHeader("Redirect");
                    if (redirect == "true") {
                        window.parent.location.href = XMLHttpRequest.getResponseHeader("RedirectUrl");
                    }
                }
            })
        }
    });
</script>
</body>

</html>
